import { getDepartmentOpt, getPersonnelOpt, getCategoryOpt } from "./enum.js"

export const getCascader = async (keys) => {
  let organizationData = {}
  for (let i = 0; i < keys.length; i++) {
    const key = keys[i]
    if (key == "department") {
      // 部门
      organizationData[key] = await getDepartmentOpt()
    } else if (key == "category") {
      // 商品分类
      organizationData[key] = await getCategoryOpt()
    } else {
      // 默认 人员
      organizationData.personnel = await getPersonnelOpt()
    }
  }
  return organizationData
}
